﻿using Glue;
using Glue.Converters;
using Xunit;

namespace GlueTests.MappingTests
{
    public class When_adding_a_relation_together_with_wrong_converter
    {
        private readonly Mapping<DomainThing, DtoThing> mapping;
        private readonly IConverter converter;

        public class DomainThing
        {
            public bool ShouldBe { get; set; }
        }

        public class DtoThing
        {
            public bool ShouldNotBe { get; set; }
        }
        public When_adding_a_relation_together_with_wrong_converter()
        {
            mapping = new Mapping<DomainThing,DtoThing>();
            converter = Converting.BetweenIntAndString();
        }

        [Fact]
        public void Should_throw_exception_when_trying_to_relate()
        {
            Assert.Throws(typeof(GlueException),()=> mapping.Relate(domain => domain.ShouldBe, dto => dto.ShouldNotBe, converter));
        }
    }
}